<template>
  <section class="comments-section animate__animated animate__fadeInUp">
    <h2>精彩评论 <a href="#">更多>></a></h2>
    <div class="comments-list">
      <div class="comment-item" v-for="comment in comments" :key="comment.id">
        <div class="comment-user">{{ comment.user }}</div>
        <div class="comment-content">{{ comment.content }}</div>
        <div class="comment-date">{{ comment.date }}</div>
      </div>
    </div>
  </section>
</template>

<script>
export default {
  name: 'CommentsSection',
  props: {
    comments: {
      type: Array,
      required: true
    }
  }
};
</script>

<style>
.comments-section {
  margin-bottom: 2rem;
}

.comments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.comment-item {
  background-color: rgba(255, 255, 255, 0.8); /* 磨砂效果 */
  backdrop-filter: blur(10px); /* 磨砂效果 */
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  flex: 1 1 calc(50% - 1rem); /* Two items per row */
  box-sizing: border-box;
  transition: transform 0.3s, box-shadow 0.3s; /* 添加动画效果 */
}

.comment-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.comment-user {
  font-weight: bold;
}

.comment-content {
  color: #888;
}

.comment-date {
  color: #888;
}
</style>
